package com.mall.util;

import java.io.Serializable;

public final class StringWrapper implements Serializable {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private String comparablestring = null;
	private String uncomparablestring = null;
public String getModifiedString() {
		return comparablestring;
	}
public void setString(String anystring) {
	if(!anystring.equalsIgnoreCase(comparablestring)){
		this.uncomparablestring = anystring;
		   anystring = anystring.trim();
		      anystring = anystring.toLowerCase();
		this.comparablestring = anystring;
	}
}
public String getNOTModifiedString() {
	return uncomparablestring;
}
protected StringWrapper(){}
public StringWrapper(String anystring){
	this.uncomparablestring = anystring;
	      anystring = anystring.trim();
	      anystring = anystring.toLowerCase();
	this.comparablestring = anystring;
	}

@Override
public int hashCode() {
	final int prime = 31;
	int result = 1;
	result = prime * result
			+ ((comparablestring == null) ? 0 : comparablestring.hashCode());
	result = prime
			* result
			+ ((uncomparablestring == null) ? 0 : uncomparablestring.hashCode());
	return result;
}
@Override
public boolean equals(Object obj) {
	if (this == obj)
		return true;
	if (obj == null)
		return false;
	if (getClass() != obj.getClass())
		return false;
	StringWrapper other = (StringWrapper) obj;
	if (comparablestring == null) {
		if (other.comparablestring != null)
			return false;
	} else if (!comparablestring.equals(other.comparablestring))
		return false;
	if (uncomparablestring == null) {
		if (other.uncomparablestring != null)
			return false;
	} else if (!uncomparablestring.equals(other.uncomparablestring))
		return false;
	return true;
}
}


